home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / qbwinfnt.zip / FILEINFO.BAS < prev    next >
BASIC Source File  |  1994-03-01  |  22KB  |  526 lines

  1.       REM:  FILEINFO.BAS, Unregistered Version 1.0
  2.       REM:  Routines to display info on FNT files or resource files.
  3.    
  4.       DECLARE SUB FontFileInfo (FlName$, RetCode%, RetMsg$)
  5.       DECLARE SUB FontDirRsrcInfo (FileNum%, FileOffset&)
  6.       DECLARE SUB FontRsrcInfo (FileNum%, FilePtr&)
  7.       DECLARE SUB RsrcFileInfo (FlName$, RetCode%, RetMsg$)
  8.  
  9.       TYPE FontDirEntryType
  10.         FontOrdinal    AS INTEGER      '...unique ordinal value identifying font
  11.         Version        AS INTEGER      '...version
  12.         Size           AS LONG         '...size of font in bytes
  13.         Copyright      AS STRING * 60  '...copyright string
  14.         FType          AS INTEGER      '...font type
  15.         Pnt            AS INTEGER      '...point size for optimum display
  16.         VertRes        AS INTEGER      '...vertical resolution in pixels per inch
  17.         HorizRes       AS INTEGER      '...horizontal resolution in pixels per inch
  18.         Ascent         AS INTEGER      '...distance from top of char cell to baseline
  19.         IntLeading     AS INTEGER      '...distance above tops of char's to top of cell
  20.         ExtLeading     AS INTEGER      '...recommended distance above top of cell
  21.         Italic         AS STRING * 1   '...italic font if equal to 1
  22.         Underline      AS STRING * 1   '...underlined font if equal to 1
  23.         StrikeOut      AS STRING * 1   '...strike-out font if equal to 1
  24.         Weight         AS INTEGER      '...relative weight
  25.         CharSet        AS STRING * 1   '...character set
  26.         PixWidth       AS INTEGER      '...width of character grid in pixels
  27.         PixHeight      AS INTEGER      '...height of character grid in pixels
  28.         PitchandFamily AS STRING * 1   '...description of pitch and family
  29.         AvgWidth       AS INTEGER      '...average width
  30.         MaxWidth       AS INTEGER      '...width of widest character
  31.         FirstChar      AS STRING * 1   '...ASCII value of first char
  32.         LastChar       AS STRING * 1   '...ASCII value of last char
  33.         DefaultChar    AS STRING * 1   '...relative char value for out of range chars
  34.         BreakChar      AS STRING * 1   '...relative char value for word seperator char
  35.         WidthBytes     AS INTEGER      '...number of bytes in each row
  36.         Device         AS LONG         '...offset in bytes to font's device name string
  37.         Face           AS LONG         '...offset in bytes to face name
  38.         Reserved       AS LONG         '...reserved
  39.       END TYPE
  40.     
  41.       TYPE FontType
  42.         Version        AS INTEGER      '...version
  43.         Size           AS LONG         '...size of font in bytes
  44.         Copyright      AS STRING * 60  '...copyright string
  45.         FType          AS INTEGER      '...font type
  46.         Pnt            AS INTEGER      '...point size for optimum display
  47.         VertRes        AS INTEGER      '...vertical resolution in pixels per inch
  48.         HorizRes       AS INTEGER      '...horizontal resolution in pixels per inch
  49.         Ascent         AS INTEGER      '...distance from top of char cell to baseline
  50.         IntLeading     AS INTEGER      '...distance above tops of char's to top of cell
  51.         ExtLeading     AS INTEGER      '...recommended distance above top of cell
  52.         Italic         AS STRING * 1   '...italic font if equal to 1
  53.         Underline      AS STRING * 1   '...underlined font if equal to 1
  54.         StrikeOut      AS STRING * 1   '...strike-out font if equal to 1
  55.         Weight         AS INTEGER      '...relative weight
  56.         CharSet        AS STRING * 1   '...character set
  57.         PixWidth       AS INTEGER      '...width of character grid in pixels
  58.         PixHeight      AS INTEGER      '...height of character grid in pixels
  59.         PitchandFamily AS STRING * 1   '...description of pitch and family
  60.         AvgWidth       AS INTEGER      '...average width
  61.         MaxWidth       AS INTEGER      '...width of widest character
  62.         FirstChar      AS STRING * 1   '...ASCII value of first char
  63.         LastChar       AS STRING * 1   '...ASCII value of last char
  64.         DefaultChar    AS STRING * 1   '...relative char value for out of range chars
  65.         BreakChar      AS STRING * 1   '...relative char value for word seperator char
  66.         WidthBytes     AS INTEGER      '...number of bytes in each row
  67.         Device         AS LONG         '...offset in bytes to font's device name string
  68.         Face           AS LONG         '...offset in bytes to face name
  69.         BitsPointer    AS LONG         '...unused and set to zero
  70.         BitsOffset     AS LONG         '...offset in bytes to start of bitmap or stroke data
  71.         Reserved1      AS STRING * 1   '...reserved
  72.       END TYPE
  73.     
  74.       TYPE ExeHdrType
  75.         Signature      AS STRING * 2   '...MZ for valid EXE code file
  76.         ExtraBytes     AS INTEGER      '...number bytes in last page
  77.         Pages          AS INTEGER      '...number whole & partial pages (512 bytes)
  78.         RelocItems     AS INTEGER      '...number relocation table pointers
  79.         HeaderSize     AS INTEGER      '...number 16 byte paragraphs in header
  80.         UnusedHere     AS STRING * 50  '...values not needed by this program
  81.         WinInfoOffset  AS INTEGER      '...offset in bytes to WinInfo structure
  82.       END TYPE
  83.    
  84.       TYPE WinInfoType
  85.         Signature      AS STRING * 2   '...NE if valid
  86.         UnusedHere1    AS STRING * 34  '...values not needed by this program
  87.         ResTabOffset   AS INTEGER      '...offset to resource table (in bytes relative to WinInfo)
  88.         UnusedHere2    AS STRING * 26  '...values not needed by this program
  89.       END TYPE
  90.      
  91.       TYPE ResInfoType
  92.         TypeID         AS INTEGER      '...resource type
  93.         ResCount       AS INTEGER      '...number of resources of this type
  94.         Reserved       AS LONG         '...unused
  95.       END TYPE
  96.  
  97.       TYPE NameInfoType
  98.         Offset         AS INTEGER      '...offset in alignment units
  99.         Length         AS INTEGER      '...length in bytes of resource
  100.         Flags          AS INTEGER      '...resource flags
  101.         ID             AS INTEGER      '...identifier
  102.         Reserved1      AS INTEGER      '...unused or reserved
  103.         Reserved2      AS INTEGER      '...unused or reserved
  104.       END TYPE
  105.  
  106.       '...setup a text mode and clear the screen...
  107.       SCREEN 0: WIDTH , 50: CLS
  108.      
  109.       PRINT "RSRCINFO.BAS, Unregistered Version 1.0"
  110.       PRINT "Routines to display info on resources in a resource file."
  111.       PRINT
  112.      
  113.       '...let user enter a resource file name...
  114.       INPUT "Enter file type: 1=font (FNT), 2=resource (FON, EXE, DLL)"; FileType%
  115.       PRINT
  116.      
  117.       IF (FileType% = 2) THEN
  118.  
  119.         '...let user enter a resource file name...
  120.         INPUT "Enter name of resource file (FON, EXE, DLL)"; FlName$
  121.      
  122.         '...get the info from the resource file...
  123.         CALL RsrcFileInfo(FlName$, RetCode%, RetMsg$)
  124.  
  125.       ELSE
  126.  
  127.         '...let user enter a resource file name...
  128.         INPUT "Enter name of font file (FNT)"; FlName$
  129.        
  130.         '...get the info from the font (FNT) file...
  131.         CALL FontFileInfo(FlName$, RetCode%, RetMsg$)
  132.  
  133.       END IF
  134.  
  135.       '...check the return code for a bad resource file...
  136.       IF (RetCode% <> 0) THEN
  137.         PRINT "***** ERROR: RetCode% = "; RetCode%
  138.         PRINT "***** "; RetMsg$
  139.       END IF
  140.  
  141.       END
  142.  
  143. '     ************************************************************************
  144.       SUB FontDirRsrcInfo (FileNum%, FileOffset&)
  145. '     ************************************************************************
  146.     
  147.       DIM FontDirEntry AS FontDirEntryType, OneByte AS STRING * 1
  148.  
  149. '     ...move the file offset into a variable we can destroy...
  150.       FilePtr& = FileOffset&
  151.  
  152. '     ...pull the font resource count and increment file ptr...
  153.       GET FileNum%, FilePtr&, FrCount%
  154.       FilePtr& = FilePtr& + 2
  155.  
  156.       PRINT "Font Dir Resource Count (FrCount): "; FrCount%
  157.   
  158.       FOR i% = 1 TO FrCount%
  159.  
  160.         '...get the next font resource entry...
  161.         GET FileNum%, FilePtr&,